<template>
  <div>
    <hr />
    newsItems列表页面
    <ul>
      <li v-for="item in items" :key="item.id">{{ item.imageName }}</li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'NewsItems',
  data() {
    return {
      items: [],
    }
  },


  created() {},

  mounted() {
    this.fetch()
  },

  methods: {
      //fetch 适用于组件请求数据
  async fetch() {
    const res = await this.$axios.get(
      'http://testapi.xuexiluxian.cn/api/slider/getSliders'
    )
    const list = res.data.data.list
    this.items = list
  },
  },
}
</script>

<style lang="scss" scoped></style>
